1: | qsort(nil) | → nil | |
2: | qsort(x . y) | → qsort(lowers(x,y)) ++ (x . qsort(greaters(x,y))) | |
3: | lowers(x,nil) | → nil | |
4: | lowers(x,y . z) | → if(y ≤ x,y . lowers(x,z),lowers(x,z)) | |
5: | greaters(x,nil) | → nil | |
6: | greaters(x,y . z) | → if(y ≤ x,greaters(x,z),y . greaters(x,z)) | |
7: | QSORT(x . y) | → QSORT(lowers(x,y)) | |
8: | QSORT(x . y) | → LOWERS(x,y) | |
9: | QSORT(x . y) | → QSORT(greaters(x,y)) | |
10: | QSORT(x . y) | → GREATERS(x,y) | |
11: | LOWERS(x,y . z) | → LOWERS(x,z) | |
12: | GREATERS(x,y . z) | → GREATERS(x,z) | |